package com.zhang.passer.controller;

import com.zhang.passer.domain.MapDo;
import com.zhang.passer.service.MapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/map")
public class MapController {


    @Autowired
    MapService mapService;

    @RequestMapping("/to3D/{name}")
    public String to3DMap(ModelMap modelMap,@PathVariable String name){
        // TODO: 2021/11/17 获取对应名称的地点坐标
        MapDo mapDo = mapService.queryOne(new MapDo().setPname(name));
        // TODO: 2021/11/13 传入地图坐标，跳转至对应地图
        String x=mapDo.getX();
        String y=mapDo.getY();
        modelMap.addAttribute("x",x);
        modelMap.addAttribute("y",y);
        return "mainMap";
    }
}
